/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.cam.can.misc;

/**
 *
 * @author Thomas
 */
public class MathTools {
    public static int factorial(int n){
        if(n<=0)
            return 1;
        int fact=1;
        for(int i = 2; i <=n; i++)
            fact*=i;
        return fact;
    }
    
    public static double log2(double num)
    {
        return (Math.log(num)/Math.log(2.0));
    }
}
